main(x,y,i,u)
{
	char c[50];
	for(gets(&x);~scanf("%d%d\n",&x,&y);printf("%d %d\n",x,y))
		for(gets(c),i=0;c[i];i++)
		{
			u=c[i]-68;
			if(!u)y--;
			else if(u==8)x--;
			else if(u==14)x++;
			else if(u==17)y++;
		}
}
